package cn.smartinvoke.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.smartinvoke.ProtocolBuilder;

class HTTPServletImpl  extends HttpServlet {

	public HTTPServletImpl() {
       
	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		this.execute(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		this.execute(request, response);
	}

	private void execute(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/plain");
        
		
		PrintWriter out = response.getWriter();
        
		List<String> list=new LinkedList<String>();
		list.add("list1");list.add("list2");
		
		String protocalstr=ProtocolBuilder.getProtocolStr(list);
		out.write(protocalstr);
		out.flush();out.close();
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		List<String> list=new LinkedList<String>();
		list.add("list1");list.add("list2");
		
		System.out.println(ProtocolBuilder.getProtocolBts(list).length);
	}

}

